package main

import (
	"fmt"
	"unsafe"
)

func main() {
	//浮点类型 float ,float64
	//复数：
	//complex64 32实数+32位虚数组成 ，虚数的单位
	//complex128 64实数+64位虚数，虚数单位i
	/*
	float32 4个字节
	float64 8个字节
	 */
	//1.以十进制的形式来展示
	var floatVariables1 float32 = 3.1415926
	floatVariables2 := .1416926 //0.1416926
	fmt.Printf("floatVariables1的类型=%T,占用的字节大小=%d\n",floatVariables1,unsafe.Sizeof(floatVariables1))
	fmt.Printf("floatVariables2的类型=%T,占用的字节大小=%d\n",floatVariables2,unsafe.Sizeof(floatVariables2))

	//2.以科学计数法来展示
	floatVariables3 := 3.1415926e2 //3.1415926乘以10的2次方
	floatVariables4 := 3.1415926e-2 //3.1415926除以10的2次方
	fmt.Println(floatVariables3,floatVariables4)

	var floatVariables5 float32 = 3.14
	var floatVariables6 float64 = 3.14
	floatVariables6 = float64(floatVariables5)
	floatVariables6 = floatVariables6

	//复数 实数"+"虚数i，虚数的单位
	//complex64 32实数+32位虚数组成 ，虚数的单位
	//complex128 64实数+64位虚数，虚数单位i
	var complexVariables1 complex64
	complexVariables1 = 3.14+12i
	complexVariables2 := complex(3.14,12)

	fmt.Printf("complexVariables1的类型=%T,值=%v\n",complexVariables1,complexVariables1)
	fmt.Printf("complexVariables2的类型=%T,值=%v\n",complexVariables2,complexVariables2)

	fmt.Println(real(complexVariables1),imag(complexVariables1))
}
